home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
program
/
eflibpt4.zip
/
DEMO
/
MISC
/
MEMDUP.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-08-02
|
967b
|
28 lines
{ Borland Pascal Extended Function Library - EFLIB (C) Johan Larsson, 1996
Demonstration; duplication of memory allocations
EFLIB IS PROTECTED BY THE COPYRIGHT LAW AND MAY NOT BE COPIED, SOLD OR
MANIPULATED. FOR MORE INFORMATION, SEE PROGRAM MANUAL! THIS DEMONSTRAT-
ION PROGRAM MAY FREELY BE USED AND DISTRIBUTED. }
uses EFLIBMEM;
var Data1, Data2: AllocationObjectPointerType;
SomeData : string;
begin
SomeData := 'Duplication of memory allocation succeeded.';
{ Initialize a data allocation and move in some data }
New (Data1, Initialize (SizeOf(SomeData)));
Data1^.MoveIn (@SomeData[0], SizeOf(SomeData), 0);
{ Duplicate allocated data into a new data allocation object }
New (Data2, InitializeDuplicate (Data1));
Data1^.Free; { Dispose first allocation }
WriteLn (String(Data2^.DataPointer(0)^));
Data2^.Free; { Dispose second allocation }
end.